package com.writer_;

import java.io.*;

/**
 * @author Vhong
 * @version 1.0
 *
 * 字符流
 */
public class BufferedCopy_ {
    public static void main(String[] args) throws IOException {

        //1.BufferedReader 和 BufferedWriter 是按照字符操作
        //2.不要去操作 二进制文件[声音，视频]，可以造成文件损坏
        String srcFile = "e:\\a.txt";
        String desrFilePath = "e:\\b.txt";

        BufferedReader br = null;
        BufferedWriter bw = null;

        String line;

        br = new BufferedReader(new FileReader(srcFile));
        bw = new BufferedWriter(new FileWriter(desrFilePath));

        while ((line = br.readLine()) != null){
            bw.write(line);
            bw.newLine();
        }
        System.out.println("拷贝完成~");
        if(br != null)
            br.close();
        if(bw != null)
            bw.close();

    }
}
